import React from 'react'
import { Redirect, useLocation } from 'react-router-dom'

const NoMatchRedirect: React.FC = () => {
  const location = useLocation()
  const toParams = {
    pathname: '/404',
    state: { referrer: location.pathname },
  }

  return <Redirect to={toParams} />
}

export default NoMatchRedirect
